/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "BookRoomDetails", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "BookRoomDetails.findAll", query = "SELECT b FROM BookRoomDetails b"),
    @NamedQuery(name = "BookRoomDetails.findByBookRoomID", query = "SELECT b FROM BookRoomDetails b WHERE b.bookRoomDetailsPK.bookRoomID = :bookRoomID"),
    @NamedQuery(name = "BookRoomDetails.findByRoomID", query = "SELECT b FROM BookRoomDetails b WHERE b.bookRoomDetailsPK.roomID = :roomID"),
    @NamedQuery(name = "BookRoomDetails.findByReserveFee", query = "SELECT b FROM BookRoomDetails b WHERE b.reserveFee = :reserveFee"),
    @NamedQuery(name = "BookRoomDetails.findByTotalPrice", query = "SELECT b FROM BookRoomDetails b WHERE b.totalPrice = :totalPrice")})
public class BookRoomDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BookRoomDetailsPK bookRoomDetailsPK;
    @Basic(optional = false)
    @Column(name = "ReserveFee", nullable = false, precision = 19, scale = 4)
    private BigDecimal reserveFee;
    @Basic(optional = false)
    @Column(name = "TotalPrice", nullable = false, precision = 19, scale = 4)
    private BigDecimal totalPrice;
    @JoinColumn(name = "RoomID", referencedColumnName = "RoomID", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Rooms rooms;
    @JoinColumn(name = "BookRoomID", referencedColumnName = "BookRoomID", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private BookRooms bookRooms;

    public BookRoomDetails() {
    }

    public BookRoomDetails(BookRoomDetailsPK bookRoomDetailsPK) {
        this.bookRoomDetailsPK = bookRoomDetailsPK;
    }

    public BookRoomDetails(BookRoomDetailsPK bookRoomDetailsPK, BigDecimal reserveFee, BigDecimal totalPrice) {
        this.bookRoomDetailsPK = bookRoomDetailsPK;
        this.reserveFee = reserveFee;
        this.totalPrice = totalPrice;
    }

    public BookRoomDetails(int bookRoomID, int roomID) {
        this.bookRoomDetailsPK = new BookRoomDetailsPK(bookRoomID, roomID);
    }

    public BookRoomDetailsPK getBookRoomDetailsPK() {
        return bookRoomDetailsPK;
    }

    public void setBookRoomDetailsPK(BookRoomDetailsPK bookRoomDetailsPK) {
        this.bookRoomDetailsPK = bookRoomDetailsPK;
    }

    public BigDecimal getReserveFee() {
        return reserveFee;
    }

    public void setReserveFee(BigDecimal reserveFee) {
        this.reserveFee = reserveFee;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Rooms getRooms() {
        return rooms;
    }

    public void setRooms(Rooms rooms) {
        this.rooms = rooms;
    }

    public BookRooms getBookRooms() {
        return bookRooms;
    }

    public void setBookRooms(BookRooms bookRooms) {
        this.bookRooms = bookRooms;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bookRoomDetailsPK != null ? bookRoomDetailsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookRoomDetails)) {
            return false;
        }
        BookRoomDetails other = (BookRoomDetails) object;
        if ((this.bookRoomDetailsPK == null && other.bookRoomDetailsPK != null) || (this.bookRoomDetailsPK != null && !this.bookRoomDetailsPK.equals(other.bookRoomDetailsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.BookRoomDetails[bookRoomDetailsPK=" + bookRoomDetailsPK + "]";
    }

}
